import {ISLOGIN,LOGOUT} from './actionType'

const defaultState={
    isLogin:window.localStorage.getItem('isLogin')=='true'?true:false,
    uid:window.localStorage.getItem('uid')||''
}

export default (state=defaultState,action)=>{
    switch(action.type){
        case ISLOGIN:{
            // console.log(action.data.isLogin,111111111111111111111111111111)
            return {
                isLogin:action.data.isLogin,
                uid:action.data.uid
            }
        }
        case LOGOUT:{
            window.localStorage.removeItem('isLogin')
            window.localStorage.removeItem('uid')

            return {
                islogin:false
            }
        }
        default: return state
    }
}

